package server;

public class MonitoringData implements Comparable<MonitoringData> {
	private long responseTime;
	private long locksCount;
	private long timeStamp;
	private NodeInfo connection;
	
	public MonitoringData() {}
	
	public MonitoringData(Long responseTime, Integer locksCount) {
		this.setResponseTime(responseTime);
		this.setLocksCount(locksCount);
	}
	
	public void setConnection(NodeInfo connection) {
		this.connection = connection;
	}

	public NodeInfo getNode() {
		return connection;
	}
	
	public long getLoad() {
		long sum = 0;		
		sum += getLocksCount();
		sum += getResponseTime();		
		return sum;
	}

	@Override
	public int compareTo(MonitoringData arg0) {
		if(arg0.getLoad() < this.getLoad())
			return -1;
		else if(arg0.getLoad() > this.getLoad())
			return 1;
		else 
			return 0;
	}

	public void setResponseTime(long responseTime) {
		this.responseTime = responseTime;
	}

	public long getResponseTime() {
		return responseTime;
	}

	public void setLocksCount(long locksCount) {
		this.locksCount = locksCount;
	}

	public long getLocksCount() {
		return locksCount;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

}
